/* Copyright 2009 Requirements Management System 
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.mags.remas.model.entity.provider;

// Generated Dec 6, 2009 5:47:57 PM by Hibernate Tools 3.2.2.GA
// powered by MAGS


import java.io.Serializable; 
import org.mags.dao.provider.CacheableDataProvider;
import org.mags.remas.model.entity.CommentType;

public class CommentTypeProvider extends CacheableDataProvider<CommentType> {
	private static final long serialVersionUID = 1L;
	public CommentTypeProvider() {
	}
	public CommentType getTODO() {
		return this.getByDescription("TODO");
	}
	public boolean isTODO(CommentType commentType) {
		return (commentType.getCommentTypeId()==this.getTODO().getCommentTypeId());
	}
	public CommentType getFIXME() {
		return this.getByDescription("FIXME");
	}
	public boolean isFIXME(CommentType commentType) {
		return (commentType.getCommentTypeId()==this.getFIXME().getCommentTypeId());
	}
	public CommentType getOTHER() {
		return this.getByDescription("OTHER");
	}
	public boolean isOTHER(CommentType commentType) {
		return (commentType.getCommentTypeId()==this.getOTHER().getCommentTypeId());
	}	
	public CommentType getWARNING() {
		return this.getByDescription("WARNING");
	}
	public boolean isWARNING(CommentType commentType) {
		return (commentType.getCommentTypeId()==this.getWARNING().getCommentTypeId());
	}
	public CommentType getByDescription(String code) {
		for(CommentType i: this.getAll())
			if(code.equalsIgnoreCase(i.getDescription()))
				return i;
		return null;
	}
	public CommentType getById(Serializable id) {
		for(CommentType i: this.getAll())
			if(i.getCommentTypeId()==((Short)id).intValue())
				return i;
		return null;
	}
	protected void loadProperties(CommentType one) {
	}
}
